<template>
  <div class="xunaren">
    <statistic-query-form @doQuery="getList" :data-uri="'/kh/statistic/rankInfo/'" :pattern="2" :dept-type="1"></statistic-query-form>
    <p class="titlefankui"><b>选人用人反馈表</b> </p>
    <p v-show="biaoyiArrShow" class="xunren">
      表一，选人用人工作民主评议表
      <span style="margin-left: 20px;color: #1ab394">参加评议人数：{{assesserCount}}</span>
      <span style="margin-left: 20px;color: #1c84c6">被评议干部数：{{khPersonCount}}</span>
    </p>
    <!--    表一-->
    <div v-show="biaoyiArrShow" v-for="wai in biaoyiArr">
      <el-table
        :data="wai.body"
        class="tablestyle"
        border>
        <el-table-column :label="item.title"  align="center" v-for="item in wai.heads">
          <el-table-column
            v-for="row in item.headItems"
            :prop="row.prop"
            align="center"
            :label="row.label">
          </el-table-column>
        </el-table-column>
      </el-table>
    </div>

    <p  v-show="biaoyiArrbShow" class="xunren">表二，新选拔任用干部民主评议表
      <span style="margin-left: 20px;color: #1ab394">参加评议人数：{{assesserCount}}</span>
      <span style="margin-left: 20px;color: #1c84c6">被评议干部数：{{khPersonCount}}</span></p>
    <!--    表一-->
    <div v-show="biaoyiArrbShow" v-for="wai in biaoyiArrb">
      <el-table
        :data="wai.body"
        class="tablestyle"
        border>
        <el-table-column :label="item.title"  align="center" v-for="item in wai.heads">
          <el-table-column
            v-for="row in item.headItems"
            :prop="row.prop"
            align="center"
            :label="row.label">
          </el-table-column>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
  import request from '@/utils/request'
  import StatisticQueryForm from '../components/StatisticQueryForm'

  export default {
    name: "Login",
    data() {
      return {
        biaoyiArrShow:true,
        biaoyiArrbShow:true,
        assesserCount:'',
        khPersonCount:'',
        //表头
        biaoyiArrb:[],
        biaoyiArr:[],
      };
    },
    components:{
      'StatisticQueryForm': StatisticQueryForm
    },
    created() {

    },
    methods: {


      getList:function(obj) {
        this.spanArr=[]
        request({
          url: obj.url,
          method: 'get',
        }).then(response => {
          debugger
          this.biaoyiArr = response.data.rankstatic2
          this.biaoyiArrb = response.data.rankstatic3
          if(this.biaoyiArr.length>0){
            this.biaoyiArrShow = true
          }else {
            this.biaoyiArrShow = false
          }
          if(this.biaoyiArrb.length>0){
            this.biaoyiArrbShow = true
          }else {
            this.biaoyiArrbShow = false
          }
          this.assesserCount = response.data.assesserCount
          this.khPersonCount = response.data.khPersonCount
          for (var i=0;i<this.biaoyiArr.length;i++){
            if(this.biaoyiArr[i].indexSatisfactionType===0){//有平均值
              for (var j=0;j<this.biaoyiArr[i].heads.length;j++){
                this.biaoyiArr[i].heads[j].title =this.biaoyiArr[i].heads[j].title + '  ( 平均分值: '+ this.biaoyiArr[i].heads[j].average.toFixed(2)+' )'
              }
            }

          }
          debugger
          for (var p=0;p<this.biaoyiArrb.length;p++){
            if(this.biaoyiArrb[p].indexSatisfactionType===0){//有平均值
              for (var k=0;k<this.biaoyiArrb[p].heads.length;k++){
                this.biaoyiArrb[p].heads[k].title =this.biaoyiArrb[p].heads[k].title + '  ( 平均分值: '+ this.biaoyiArrb[p].heads[k].average.toFixed(2)+' )'
              }
            }

          }

        });
      },

    }
  };
</script>

<style  lang="scss">
  .xunaren .titlefankui {
    width: 95%;
    text-align: center;
    margin-top: 20px;
    font-size: 20px;
  }
  .xunaren .xunren {
    text-align: center;
  }

  .xunaren .tablestyle {
    width: 95%;
    margin-left: 20px;
    margin-bottom: 20px;
    font-size: 14px;
  }

</style>
